// 构造器模式

function Car(brand, price, speed) {
    this.brand = brand;
    this.price = price;
    this.speed = speed;
    Car.prototype.detil = function (params) {
        return `我是${this.brand}品牌，价格${this.price},速度${this.speed}`
    }

}
let car = new Car("bmm", "2000", "100")
console.log(car.detil())





function GirlFriend(name, age, cup, hobby, birthplace, eatType) {
    this.name = name;
    this.age = age;
    this.cup = cup;
    this.hobby = hobby;
    this.birthplace = birthplace;
    this.eatType = eatType
}

function FactoryGirlFriend(name, age, cup, hobby, birthplace) {
    let eatType = '';
    switch (birthplace) {
        case 'chongqing':
            eatType = '吃辣，辣的一匹';
            break;
        case 'guangzhou':
            eatType = '吃清淡，喝粥喝茶';
            break;
        case 'fuzhou':
            eatType = '沙县，闽南菜';
            break;
    }
    return new GirlFriend(name, age, cup, hobby, birthplace,eatType);
}
let bf = new FactoryGirlFriend("黄金", 19, 90, "大雨",  "chongqing")
console.log(bf)